<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    	<title>统战成员学习平台</title>
	    <link rel="stylesheet" type="text/css" href="../../css/base.css" />
	    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
	</head>
	<body class="white">
		<div id='app' style="display:none" v-show="true">
			<div class="exam_result_info">
				<div :class="examResult.isQualified?'passed':'not_passed'">
					<p class="chapter"><i class="icon_chapter"></i>{{name}}</p>
					<p class="question_sum">试题：{{examResult.errorNum+examResult.correctNum}}</p>
					<p class="question_error">错误：{{examResult.errorNum}}</p>
					<p class="score"><span>{{examResult.score}}</span>分</p>
				</div>
			</div>
			<p class="answer_list ui_border_t ui_border_b">考试详情</p>
			<ul class="question_list" :style="{'height': height - 330 + 'px'}">
				<li v-for="(item, i) of examResult.resultList" :class="{'active': item.isCorrect}"><span>{{i+1}}</span></li>
			</ul>
			<div tapmode='tap' @click="closeToPlan()" class="start_exam">返回</div>
			<p class="last_exam_time">剩余次数：{{examResult.flunkNum === -1 ? '不限次数' : examResult.flunkNum}}</p>
		</div>
		<script type="text/javascript" src="../../script/api.js"></script>
		<script type="text/javascript" src="../../script/vue.min.js"></script>
		<script type="text/javascript" src="../../script/common.js"></script>
		<script type="text/javascript" src="../../script/layer_mobile/layer.js"></script>
		<script type="text/javascript">
		    new Vue({
				el: '#app',
		     	data: {
					height: 400,
					name: '',
					type: 0,
					scheduleId: 0,
					examId: 0,
					scoreId: '',
					examResult: {}
		     	},
					/*
				computed: {
					result: function() {
						var $this = this,
							result = [],
							flag = false;
						$this.questions.forEach(function(question) {
							flag = $this.examResult.correctlist.some(function(item) {
								if(question.qustionId === item.qustionId) {
									question.isCorrect = 1;
									question.rightAnswer = item.answer;
									return true;
								}
							});
							if(!flag) {
								$this.examResult.errorList.some(function(item) {
									if(question.qustionId === item.qustionId) {
										question.isCorrect = 0;
										question.rightAnswer = item.answer;
										return true;
									}
								})
							}
							result.push(question);
						});
						$api.setStorage(_.EXAMANSWER, result);
						return result;
					}
				},
				*/
				mounted: function() {
		        	var $this = this;
		        	apiready = function() {
								$this.name = api.appParam.name;
								$this.scheduleId = api.pageParam.scheduleId;
								$this.examId = api.pageParam.examId;
								$this.scoreId = api.pageParam.scoreId;
								$this.examResult = JSON.parse(api.pageParam.examResult);
								$this.height = api.frameHeight;
								api.addEventListener({
								    name: 'closeToPlan'
								}, function(ret, err){
								    $this.closeToPlan();
								});

								parseTapmode();
            	}
	    	},
	    	methods: {
					checkAnswer: function(item) {
						openWin('check_answer_win', {result: item})
					},
					closeToPlan: function(){
						var $this = this;
						api.sendEvent({
								name: 'reloadPlan'
						});
						api.closeToWin({
								name: 'plan_details_win'
						});
					}
		    }
		  });
		</script>
	</body>
</html>
